//
//  UIImage+GYColorImage.m
//  LockManagement
//
//  Created by apple on 2018/7/24.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

#import "UIImage+GYColorImage.h"

@implementation UIImage (GYColorImage)

+ (UIImage *)colorImage:(CGSize)imageSize ImageColor:(UIColor *)color {
    //1.开始上下文
    CGRect rect = CGRectMake(0, 0, imageSize.width, imageSize.height);
    UIGraphicsBeginImageContext(imageSize);
    
    //得到当前上下文
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;

}
@end
